Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cat-log: list out/err files when available via tailer #6480

Merged

Conversation

oliver-sanders
Copy link
Member

@oliver-sanders oliver-sanders commented Nov 15, 2024

Closes #5802

List log files that are not present on disk but which are available via a tailer.

Check List

  • I have read CONTRIBUTING.md and added my name as a Code Contributor.
  • Contains logically grouped changes (else tidy your branch by rebase).
  • Does not contain off-topic changes (use other PRs for other changes).
  • Applied any dependency changes to both setup.cfg (and conda-environment.yml if present).
  • Tests are included (or explain why tests are not needed).
  • Changelog entry included if this is a change that can affect users
  • Cylc-Doc pull request opened if required at cylc/cylc-doc/pull/XXXX.
  • If this is a bug fix, PR should be raised against the relevant ?.?.x branch.

@oliver-sanders oliver-sanders changed the base branch from master to 8.3.x November 15, 2024 14:36
@oliver-sanders oliver-sanders added this to the 8.3.7 milestone Nov 15, 2024
@oliver-sanders oliver-sanders self-assigned this Nov 15, 2024
@oliver-sanders oliver-sanders added the could be better Not exactly a bug, but not ideal. label Nov 15, 2024
@oliver-sanders

This comment was marked as outdated.

@hjoliver hjoliver modified the milestones: 8.3.7, 8.4.1 Jan 8, 2025
@MetRonnie MetRonnie changed the base branch from 8.3.x to 8.4.x January 9, 2025 18:33
@oliver-sanders oliver-sanders force-pushed the cat-log-list-tailable-files branch 4 times, most recently from 320f8f4 to 39e17e5 Compare January 27, 2025 16:49
@oliver-sanders oliver-sanders marked this pull request as ready for review January 27, 2025 16:49
@oliver-sanders oliver-sanders force-pushed the cat-log-list-tailable-files branch from 39e17e5 to f8a248c Compare January 28, 2025 10:47
Copy link
Member

@wxtim wxtim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Read code
  • Ran new test
  • Tried manually testing, including looking at available log files in TUI before and after.
  • Ran new test with coverage. Lines indicated in the diff were covered.

changes.d/6480.fix.md Outdated Show resolved Hide resolved
cylc/flow/scripts/cat_log.py Show resolved Hide resolved
Comment on lines +604 to +615
proc = remote_cylc_cmd(
cmd,
platform,
capture_process=False,
capture_process=(mode == 'list-dir'),
manage=(mode == 'tail'),
text=False
text=(mode == 'list-dir'),
)
if (
mode == 'list-dir'
and os.path.exists(
os.path.join(
local_log_dir,
'job-activity.log'
)
)
):
# add the local-only job-activity.log file to the remote-list
print('job-activity.log')

# add and missing items to file listing results
if isinstance(proc, Popen):
# i.e: if mode=='list-dir' and ctrl+c not pressed
out, err = proc.communicate()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to include the proc.communicate() in the suppressing of the KeyboardInterrupt

Copy link
Member Author

@oliver-sanders oliver-sanders Feb 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a suppress block, so the code execution will continue on if KeyboardInterrupt is caught leading to an error further on in the code.

As it stands, if you ctrl+c here, you'll get a KeyboardInterrupt traceback:

Traceback (most recent call last):
...
KeyboardInterrupt

But if we do the awaiting inside this block, it just turns into a different error:

Traceback (most recent call last):
...
File "cylc/flow/scripts/cat_log.py", line 607, in _main
AttributeError: 'NoneType' object has no attribute 'splitlines'

I don't think kill signals are very well handled here at present, not really the fault of this PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the whole if isinstance block is included in the suppress block, it avoids traceback on ctrl+c. But not that important I guess

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The traceback is a cosmetic problem, but I think there are pre-existing functional issues here, #6609

@oliver-sanders oliver-sanders force-pushed the cat-log-list-tailable-files branch from d46501f to beb2a09 Compare February 12, 2025 16:38
* The `--mode=list-dir` option lists log files which are available to
  view.
* This commit includes remote `job.out` and `job.err` files which are
  available via platform tailer/viewer commands.
* Note, these log files are only listed if accessible via *both* a
  tailer and a viewer in order to prevent ambiguity (these are typically
  configured together anyway).
@oliver-sanders oliver-sanders force-pushed the cat-log-list-tailable-files branch from beb2a09 to 4714a46 Compare February 13, 2025 15:41
Copy link
Member

@MetRonnie MetRonnie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Take or leave my KeyboardInterrupt suggestions

@oliver-sanders
Copy link
Member Author

oliver-sanders commented Feb 14, 2025

Take or leave my KeyboardInterrupt suggestions

I think we need to do more than just swallow the traceback. Have opened an issue: #6609

@oliver-sanders oliver-sanders merged commit ba6043d into cylc:8.4.x Feb 14, 2025
27 checks passed
@oliver-sanders oliver-sanders deleted the cat-log-list-tailable-files branch February 14, 2025 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
could be better Not exactly a bug, but not ideal.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cat-log: list job.out and job.err when jobs are running that require a tailer to access
4 participants